﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson3 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        UserInfo2 user = new UserInfo2();
        user.name = "zabry";
        user.age = 18;
        user.sex = false;
        user.valf = 12.12f;
        user.vald = 2.31215125;
        user.ids = new int[] { 1, 2, 3, 4, 5, 6, 7 };
        user.ids2 = new List<int>() { 10, 20, 30, 40 };
        user.dic = new Dictionary<string, string>() { { "100", "long time no see" }, { "200", "what you name" }, { "300", "goto bed" } };
        user.dic2 = new Dictionary<string, string> { { "a", "aaa" }, { "b", "bbb" }, { "c", "ccc" } };
        user.item = new Item2(10000, "正阳鞋", 1);
        user.item2 = null;
        user.items = new List<Item2>() { new Item2(100, "十字镐", 1), new Item2(101, "木头", 100), new Item2(102, "石头", 130) };
        user.SetVal(1111, 2222);
        JsonMgr.Instance.Save("userInfo", user);

        UserInfo2 user2 = JsonMgr.Instance.Read<UserInfo2>("userInfo");
        Debug.LogFormat("user2 name:{0}", user2.name);
    }
}
